﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace ComeSeeThis_MVC2
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // These routes are here to allow for paging long lists
            routes.MapRoute("Motors", "Motor/Page/{page}", new { controller = "Motor", action = "Index" });
            routes.MapRoute("Companies", "Company/Page/{page}", new { controller = "Company", action = "Index" });
            routes.MapRoute("Vehicles", "Vehicle/Page/{page}", new { controller = "Vehicle", action = "Index" });
            routes.MapRoute("GearingRec1", "GearingRec/Search/{vehicleCompanyId}", new {controller = "GearingRec", action = "Search"});
            routes.MapRoute("GearingRec2", "GearingRec/Search/{vehicleCompanyId}/{vehicleId}", new {controller = "GearingRec", action = "Search"});
            routes.MapRoute("GearingRec3", "GearingRec/Search/{vehicleCompanyId}/{vehicleId}/{vehicleTypeId}", new { controller = "GearingRec", action = "Search" });
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}